package zfc;

public class P2 {
    public String[] solve(String[] words, int index, int count) {
        if (index - count >= 0) {
            String[] result = new String[words.length - count];
            //前
            int idx = 0;
            for (int i = 0; i <= index - count; i++) {
                result[idx++] = words[i];
            }
            //后
            for (int i = index+1; i < words.length; i++) {
                result[idx++] = words[i];
            }
            return result;
        } else {
            int idx = 0;
            String[] result = new String[words.length - index - 1];
            for (int i = index + 1; i < words.length; i++) {
                result[idx++] = words[i];
            }
            return result;
        }
    }

    public static void main(String[] args) {
        String[] words = new String[]{"h", "w", "i", "m", "f", "p"};
        String[] solve = new P2().solve(words, 2, 10);
        for (String s : solve) {
            System.out.print(s + ",");
        }
    }

}
